:root {
    --primary-color: #3498db;
    --secondary-color: #2980b9;
    --background-color: #f5f7fa;
    --card-color: #ffffff;
    --text-color: #333333;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-color: #e1e4e8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 头部样式 */
.site-header {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow);
    width: 100%;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    width: 100%;
    position: relative;
}

/* 返回按钮样式 */
.back-btn {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.back-btn i {
    margin-right: 5px;
}

/* 标题居中 */
.header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    font-size: 1.8rem;
}

/* 平衡布局的空div */
.header-spacer {
    width: 120px;
}

/* 主内容区域 */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    width: 100%;
    flex: 1;
}

/* 文章区域 */
.article-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin: 2rem 0;
}

.article-header {
    background-color: var(--card-color);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.article-title {
    font-size: 2rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.article-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.article-meta-item {
    display: flex;
    align-items: center;
}

.article-meta-item i {
    margin-right: 5px;
}

.article-tags {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.article-tag {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background-color: #f0f7ff;
    color: var(--primary-color);
    border-radius: 4px;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s;
}

.article-tag:hover {
    background-color: var(--primary-color);
    color: white;
}

.article-thumbnail {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.article-content {
    background-color: var(--card-color);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* Markdown内容样式 */
.markdown-body {
    font-size: 1rem;
    line-height: 1.7;
    color: #24292e;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-body h1 {
    padding-bottom: 0.3em;
    font-size: 1.8em;
    border-bottom: 1px solid #eaecef;
}

.markdown-body h2 {
    padding-bottom: 0.3em;
    font-size: 1.5em;
    border-bottom: 1px solid #eaecef;
}

.markdown-body p {
    margin-top: 0;
    margin-bottom: 16px;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 2em;
    margin-top: 0;
    margin-bottom: 16px;
}

.markdown-body blockquote {
    padding: 0 1em;
    color: #6a737d;
    border-left: 0.25em solid #dfe2e5;
    margin: 0 0 16px 0;
}

.markdown-body pre {
    padding: 16px;
    overflow: auto;
    background-color: #f6f8fa;
    border-radius: 3px;
    line-height: 1.45;
}

.markdown-body code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 85%;
    background-color: rgba(27, 31, 35, 0.05);
    border-radius: 3px;
    padding: 0.2em 0.4em;
}

.markdown-body pre code {
    background-color: transparent;
    padding: 0;
}

.markdown-body table {
    border-spacing: 0;
    border-collapse: collapse;
    display: block;
    width: 100%;
    overflow: auto;
}

.markdown-body table th {
    font-weight: 600;
}

.markdown-body table th,
.markdown-body table td {
    padding: 6px 13px;
    border: 1px solid #dfe2e5;
}

.markdown-body table tr {
    background-color: #fff;
    border-top: 1px solid #c6cbd1;
}

.markdown-body table tr:nth-child(2n) {
    background-color: #f6f8fa;
}

/* 作者信息 */
.author-card {
    background-color: var(--card-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.author-info {
    flex: 1;
}

.author-name {
    font-size: 1.2rem;
    margin: 0 0 0.5rem 0;
}

.author-bio {
    color: #666;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.author-social {
    display: flex;
    gap: 0.8rem;
}

.author-social a {
    color: var(--primary-color);
    font-size: 1.2rem;
    text-decoration: none;
}

/* 相关文章 */
.related-articles {
    background-color: var(--card-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.section-title {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.section-title i {
    margin-right: 10px;
    color: var(--primary-color);
}

.related-article-list {
    display: grid;
    gap: 1rem;
}

.related-article {
    display: flex;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
}

.related-article:last-child {
    border-bottom: none;
}

.related-article-thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.related-article-title {
    font-size: 1rem;
    margin: 0;
    line-height: 1.3;
}

.related-article-title a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

.related-article-title a:hover {
    color: var(--primary-color);
}

.related-article-meta {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.3rem;
}

/* 评论区 */
.comments-section {
    background-color: var(--card-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.comment-form {
    margin-bottom: 2rem;
}

.comment-form textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-height: 120px;
    margin-bottom: 1rem;
    font-family: inherit;
}

.comment-form button {
    padding: 0.7rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.comment-form button:hover {
    background-color: var(--secondary-color);
}

.comment-list {
    display: grid;
    gap: 1.5rem;
}

.comment {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.comment:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.comment-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: bold;
    margin-right: 0.8rem;
}

.comment-date {
    color: #666;
    font-size: 0.8rem;
}

.comment-text {
    line-height: 1.6;
}

.comment-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.8rem;
}

.comment-action {
    color: #666;
    font-size: 0.8rem;
    text-decoration: none;
    transition: color 0.3s;
}

.comment-action:hover {
    color: var(--primary-color);
}

/* 侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 2rem;
}

.sidebar-card {
    background-color: var(--card-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.popular-article {
    display: flex;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
}

.popular-article:last-child {
    border-bottom: none;
}

.popular-article-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.popular-article-title {
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.3;
}

.popular-article-title a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

.popular-article-title a:hover {
    color: var(--primary-color);
}

.popular-article-views {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.3rem;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-cloud-item {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background-color: #f0f7ff;
    color: var(--primary-color);
    border-radius: 4px;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s;
}

.tag-cloud-item:hover {
    background-color: var(--primary-color);
    color: white;
}

.tag-cloud-item.size-1 { font-size: 0.8rem; }
.tag-cloud-item.size-2 { font-size: 0.9rem; }
.tag-cloud-item.size-3 { font-size: 1rem; }
.tag-cloud-item.size-4 { font-size: 1.1rem; }
.tag-cloud-item.size-5 { font-size: 1.2rem; }

/* 页脚 */
.site-footer {
    width: 100%;
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
    color: #666;
    border-top: 1px solid var(--border-color);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 0;
    }
    
    .header-title {
        position: static;
        transform: none;
        order: -1;
    }
    
    .header-spacer {
        display: none;
    }
    
    .back-btn {
        align-self: flex-start;
    }
    
    .article-header {
        padding: 1.5rem;
    }
    
    .article-content {
        padding: 1.5rem;
    }
    
    .author-card {
        flex-direction: column;
        text-align: center;
    }
    
    .comment {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .article-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}